<template>
  <!-- 海报 -->
  <div class="poster">
    <template v-for="(item, index) in widgetData.value">
      <div class="image" :key="index" :id="item.siteId">
        <!-- 热力图 -->
        <template v-for="(ele,idx) in mapData">
          <div v-if="ele.sitePageId == item.siteId" :key="idx+'a'" class="mark"
            :style="{background:`#${ele.color}`,opacity:0.9}">
            <div>
              <div class="name">PV：{{ele.exposurePv}}</div>
              <div class="name">UV：{{ele.exposureUv}}</div>
            </div>
            <div class="level">Lv.{{ele.level}}</div>
          </div>
        </template>
        <!-- 组件 -->
        <template v-if="item.url!=''">
          <a :href="item.link">
            <img :src="item.url">
          </a>
        </template>
        <template v-else>
          <div class="image-null"><i class="el-icon-picture"></i></div>
        </template>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  name: "poster",
  props: {
    widgetData: {
      type: Object,
      required: true
    },
    // 热力图
    mapData:{
      type: Array,
      default: () => []
    }
  },
  data () {
    return {}
  },
  methods: {},
}
</script>

<style lang="less" scoped>
.poster {
  width: 100%;
  height: 100%;
  .image{
    width: 100%;
    height: 100%;
    position: relative;
    // 热力图
    .mark{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      padding: 10px 15px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .name{
        color: #ffffff;
      }
      .level{
        color: #ffffff;
        text-align: right;
      }
    }
  }
  img{
    max-width: 100%;
    width: 100%;
    height: 100%;
  }
  .image-null{
    background: #ffffff;
    height: 100%;
    font-size: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c1c1c1;
    width: 100%;
  }
  // 锚点定位
  .anchor{
    box-shadow: 1px 1px 10px 10px red;
  }
}
</style>